package com.huawei.classroom.student.h05;

public class GameObject {
	public int health;
	public int damage;
	public int getHealth() {
		return this.health;
	}
	public void attack(GameObject who) {
		who.health -= this.damage;
		this.dead(who);
	}
	public void dead(GameObject who) {
		if(who.isDestroyed()) {
			if(who instanceof NoDog) {
				Soldier.deadedSoldier++;
			}
		}
	}
	public boolean isDestroyed() {
		return this.health<=0;
	}
}
